Skip to main content

Check for Symmetricity

is_symmetric(input: any[] | Mat) : boolean

param input - Any matrix, two-dimensional and square, to test if it's symmetric or not

returns: - boolean - True if it is symmetric (recall symmetric means the rows and columns being interchanged doesn't affect the matrix), false otherwise

This function tests if a square 2d matrix is symmetric or not. One way to visually check is look at the diagonal - if the elements are symmetric across that, it is symmetric.